<!DOCTYPE html>
<html>
  <head>
    <title>Palindrome</title>
    <meta charset="utf-8">
    <script type="text/javascript" src="../scripts/assert.js"></script>
    <link href="../styles/assert.css" rel="stylesheet" type="text/css">
  </head>
  <body>
    <script type="text/javascript">

      function isPalindrome(text) {
        if (text.length <= 1) return true;
        if (text.charAt(0) != text.charAt(text.length - 1)) return false;
        return isPalindrome(text.substr(1,text.length -2));
      }

      assert(isPalindrome(""),"blank")
      assert(isPalindrome("x"),"single")
      assert(isPalindrome("oxo"),"odd")
      assert(isPalindrome("abba"),"even")
      assert(isPalindrome("abbar"),"not")

    </script>
  </body>
</html>

